/*
 *
假定居民的基本数据包括身份证号、姓名、性别和出生日期,
而居民中的成年人又多两项数据:最高学历和职业,
成年人中的党员又多一项数据:党员类别。
现要求建立三个类,让成年人类继承居民类,而党员类继承成年人 类,并要求在每个类中都提供有数据输入和输出的功能
 *
 */
#include<iostream>
using namespace std;

class Resident{
	protected:
		string m_idNo;
		string m_name;
		string m_sex;
		string m_birthDate;
	public:
		virtual void input(){
			cout << "input idNo: " << endl;
			cin >> m_idNo;
			
			cout << "input name: " << endl;
			cin >> m_name;

			cout << "input sex: " << endl;
			cin >> m_sex;

			cout << "input birhdate " << endl;
			cin >> m_birthDate;
		}
		virtual void output(){
			cout << "证件号：" << m_idNo << " 姓名：" << m_name << " 性别：" << m_sex << " 出生年月： " << m_birthDate << endl;
		}
};

class Adult: public Resident{
	protected:
		string m_edu;
		string m_job;
	public:
		void input(){
			Resident::input();
			
			cout << "input edu " << endl;
			cin >> m_edu;

			cout << "input job " << endl;
			cin >> m_job;
		}
		void output(){
			Resident::output();
			cout << "学历：" << m_edu << "职业：" << m_job << endl;
		}
};

class Party: public Adult{
	protected:
		string m_type;
	public:
		void input(){
			Adult::input();
			cout << "input type : " << endl;
			cin >> m_type;
		}
		void output(){
			Adult::output();
			cout << "党员类别：" << m_type << endl;	
		}
};

int main(){

	Resident r;
	cout << "请输入居民信息：" << endl;
	r.input();
	cout << "居民信息如下：" << endl;
	r.output();

	Adult a;
	cout << "请输入成年人信息：" << endl;
	a.input();
	cout << "成年人信息如下：" << endl;
	a.output();	

	Party p;
	cout << "请输入党员信息：" << endl;
	p.input();
	cout << "党员信息如下：" << endl;
	p.output();

	return 0;
}
